package nl.haemers.ui.grids 
{
	import nl.haemers.ui.buttons.BaseButton;
	import nl.haemers.geom.BaseCell;
	
	/**
	 * ...
	 * @author Jonathan Haemers
	 */
	public class Cell extends BaseCell
	{
		protected var cellBtn			:BaseButton;
		
		public function Cell() 
		{
			super();
		}
		
		/** Public methods **/
		override public function draw() : void
		{
			setCellProperties();
			super.draw();
		}
		
		/** Getters & Setters **/

		/** Protected methods **/
		override protected function startup() : void
		{
			if (cellBtn)
			{
				configListeners();
			}
		}
		
		protected function configListeners() : void
		{
			
		}
		
		protected function setCellProperties() : void
		{
			cellHeight = 20;
			cellWidth = 20;
			
			this.x = cellWidth * cellLocation.x;
			this.y = cellHeight * cellLocation.y;
		}
		
		override protected function drawCell() : void
		{
			cellBtn = new BaseButton();
			cellBtn.graphics.lineStyle(1, 0x000000, 1);
			cellBtn.graphics.beginFill(0xFF0000, .2);
			cellBtn.graphics.drawRect(cellWidth * -.5, cellHeight * -.5, cellWidth, cellHeight);
			cellBtn.graphics.endFill();
			
			addChild(cellBtn);
		}
		
	}

}